class Solution(object):
    def daysBetweenDates(self, date1, date2):
        date1, date2 = min(date1, date2), max(date1, date2)

        def judge(y):
            if y % 4 == 0:
                if y % 100 == 0:
                    if y % 400 == 0:
                        return True
                    else:
                        return False
                else:
                    return True
            else:
                return False

        def cal(y, m, d):
            t = 0
            for k in range(1, m):
                if k in {1, 3, 5, 7, 8, 10}:
                    t += 31
                if k in {4, 6, 9, 11}:
                    t += 30
                if k == 2:
                    if judge(y):
                        t += 29
                    else:
                        t += 28
            return t + d
        y1, m1, d1 = date1.split('-')
        y1, m1, d1 = int(y1), int(m1), int(d1)
        y2, m2, d2 = date2.split('-')
        y2, m2, d2 = int(y2), int(m2), int(d2)
        ans = 0
        for k in range(y1, y2):
            if judge(k):
                ans += 366
            else:
                ans += 365
        return ans + cal(y2, m2, d2) - cal(y1, m1, d1)


data = Solution()
date1 = "2020-01-15"
date2 = "2019-12-31"
print(data.daysBetweenDates(date1, date2))
